package com.atguigu.springcloud.page;

import org.springframework.data.domain.Pageable;
/**
 * Created by luojie on 2018/9/7.
 */
public class PageRequestConverter {

    /**
     * 转换PageRequest为spring data Pageable
     * @param pageRequest PageRequest
     * @return Pageable
     */
    /**
     * 转换PageRequest为spring data Pageable
     * @param pageRequest PageRequest
     * @return Pageable
     */
    public static Pageable convertToSpringDataPageable(PageRequest pageRequest) {
        return org.springframework.data.domain.PageRequest.of(pageRequest.getPageNo() - 1, pageRequest.getPageSize(), SimpleOrderConverter.convertToSort(pageRequest.getSimpleOrderList()));
    }

}
